package com.project.fortuneteller.mappers;

import com.project.fortuneteller.pojo.DivinatoryDetails;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 获取  每一卦的详细信息
 * 卦象的 属性 卦象的卦辞  和 解释
 */

@Mapper
public interface DivinatoryDetailsMapper {

    /**
     * 获取卦象相关全部信息
     * @param id
     * @return
     */
    @Select("select * from divinatory_details where id = #{id}")
    DivinatoryDetails getById(String id);

    /**
     * 获取卦象解释
     * @param id
     * @return
     */
    @Select("select divinatory_explain from divinatory_details where id = #{id}")
    String getExplainById(String id);

    /**
     *  模糊匹配 获取卦象的信息
     * @param content
     * @return
     */
    @Select("select * from divinatory_details where divinatory_name like #{content} or divinatory_explain like #{content} limit  #{pageBegin},#{pageSize}")
    List<DivinatoryDetails> getByLike(String content, int pageBegin, int pageSize);

}
